Component({
  properties: {

  },
  data: {
    showModal: false,
    selected: 1,
    color: "#7A7E83",
    selectedColor: "#ffc700",
    "list": [{
        "selectedIconPath": "/img/homeSelect.png",
        "iconPath": "/img/home.png",
        "pagePath": "/pages/index/index",
        "text": "首页"
      },
      {
        "selectedIconPath": "/img/xinSelect.png",
        "iconPath": "/img/xin.png",
        "pagePath": "/pages/discover/discover",
        "text": "宠圈"
      },
      {
        "selectedIconPath": "/img/join.png",
        "iconPath": "/img/join.png",
        "pagePath": "/pages/join/join",

      },
      {
        "selectedIconPath": "/img/dogSelect.png",
        "iconPath": "/img/dog.png",
        "pagePath": "/pages/news/news",
        "text": "消息"
      },
      {
        "selectedIconPath": "/img/headSelect.png",
        "iconPath": "/img/head.png",
        "pagePath": "/pages/my/my",
        "text": "我的"
      }
    ]
  },

 



  methods: {
    // close_mask: function() {
    //   this.setData({
    //     showModal: true
    //   })
    // },
    switchTab(e) { 
      const data = e.currentTarget.dataset
      const url = data.path
      const index = data.index
      if(index == 2){
        let show = this.data.showModal;
        console.log(show);
        this.setData({
          showModal: !this.data.showModal
        })
        return
      }
      wx.switchTab({
        url
      })
      this.setData({
        selected: data.index
      })

    },
    tab(e) {
      console.log(e.currentTarget.dataset.type)
      var index = e.currentTarget.dataset.type
      if (index == 0) {
        wx.redirectTo({
          url: '/pages/index/index',
        })
      } else if (index == 1) {
        wx.redirectTo({
          url: '/pages/discover/discover',
        })
      } else if (index == 2) {
        let show = this.data.showModal;
        console.log(show);
        this.setData({
          showModal: !this.data.showModal
        })
      } else if (index == 3) {
        wx.redirectTo({
          url: '/pages/news/news',
        })
      } else {
        wx.redirectTo({
          url: '/pages/my/my',
        })
      }
      this.setData({
        active: index
      })
    }
  }
})